package com.sunkyc.controller.system;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.sunkyc.commons.annotation.ReqLog;
import com.sunkyc.commons.entity.PageQueryVo;
import com.sunkyc.commons.entity.R;
import com.sunkyc.commons.entity.TablePageData;
import com.sunkyc.framework.system.entity.SysLoginLog;
import com.sunkyc.framework.system.entity.SysReqLog;
import com.sunkyc.framework.system.service.SysReqLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/reqLog")
@Api(tags = "操作日志前端控制器")
@RequiredArgsConstructor
public class SysReqLogController {
    private final SysReqLogService baseService;


    @GetMapping("/list")
    @ApiOperation("操作日志分页信息")
    @SaCheckPermission("system-log-req-query")
    public R<TablePageData<SysReqLog>> queryList(PageQueryVo pageQueryVo, SysReqLog sysReqLog){
        return R.ok(baseService.queryList(pageQueryVo,sysReqLog));
    }


    @DeleteMapping
    @ApiOperation("清空操作日志")
    @SaCheckPermission("system-log-req-delete")
    @ReqLog
    public R<Void> delLoginLog(){
        return R.result(baseService.deleReqLog());
    }



}
